<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!-- Website template by freewebsitetemplates.com -->
<html>
<head>
    <title>Reservation - Steak House Website Template</title>
    <script src="./js/jquery-3.4.1.min.js"></script>
    <meta charset="utf-8">
    <link href="../META-INF/resources/WEB-INF/views/css/style.css" rel="stylesheet" type="text/css">
    <!--[if IE 6]>
    <link href="css/ie6.css" rel="stylesheet" type="text/css">
    <![endif]-->
    <!--[if IE 7]>
    <link href="css/ie7.css" rel="stylesheet" type="text/css">
    <![endif]-->
</head>
<body>
<div id="background">
    <div class="page">
        <div id="header">
            <ul class="navigation">
                <li>
                    <a href="login.jsp">价目表</a>
                </li>
                <li>
                    <a href="login.jsp">啤酒</a>
                </li>
            </ul>
            <a id="logo" href="login.jsp"><img src="images/logo2.jpg" width="276" height="203" alt="Steak House" title="Steak House"></a>
            <ul id="navigation">
                <li>
                    <a href="login.jsp">预订</a>
                </li>
                <li>
                    <a href="login.jsp">联系我们</a>
                </li>
            </ul>
        </div>
        <div id="body">
            <div class="content" style="height: 400px;width: 500px">
                <div class="body" style="text-align: center">
                    <p style="text-align: center;font-size: 26px">登陆系统</p><br>
                    <form id="ff" action="${pageContext.request.contextPath}/userLogin" method="post" onsubmit="return check()" style="float: top;height: 118px">
                        <div style="margin-bottom:10px">
                            <h1 style="font-size: 16px">
                                用户名称：<input id="UserName" type="text" name="UserName" value="<%= request.getAttribute("UserName")%>" style="width:180px"/>
                            </h1>
                        </div><br>
                        <div style="margin-bottom:10px">
                            <h1 style="font-size: 16px">
                                用户密码：<input id="PassWord" type="password" name="PassWord" value="<%= request.getAttribute("PassWord")%>" style="width:180px;"/>
                            </h1>
                        </div><br>
                        <input style="position:relative;top: 0px; right: 50px" type="submit" value="登陆"/>
                    </form>
                    <form action="/NewSteak_war_exploded/register" >
                        <button href="register" style="position:relative;top: 0px;left:40px" type="submit">注册</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    function check(){
        const username = document.getElementById('UserName').value;
        const password = document.getElementById("PassWord").value;
        console.log(username)
        if(username.length == 0 || username == null){
            alert("用户名不能为空");
            return false;
        }
        if(password.length == 0 || password == null){
            alert("密码不能为空");
            return false;
        }
        if(username.length > 20){
            alert("用户名过长");
            return false;
        }
        if(password.length > 20){
            alert("密码过长");
            return false;
        }
        if(username.indexOf(" ") > -1){
            alert("用户名中不能有空格");
            return false;
        }
        if(password.indexOf(" ") > -1){
            alert("密码中不能有空格");
            return false;
        }
        return true;
    }
</script>
</html>